/**
 * 
 */
package edu.hadassah.store.policy;

import edu.hadassah.store.client.IClient;
import edu.hadassah.store.management.IStoreManagement;
import edu.hadassah.store.uniqueid.IUniqueId;

/**
 * @author persikov
 *
 */
public aspect ClientOperationPolicy {
	
	
	pointcut removeClient(IStoreManagement storeManagement, IUniqueId clientId) : target(storeManagement) && args(clientId) && call(boolean IStoreManagement+.removeClient(IUniqueId));

	/**
	 * @param storeManagement
	 * @param orderId
	 * @return
	 */
	boolean around (IStoreManagement storeManagement, IUniqueId clientId):removeClient(storeManagement, clientId){
		IClient client = storeManagement.getClient(clientId);
		Trace.traceEntry(thisJoinPoint);
		if (client == null || client.hasOrders()) {
			return false;
		} 
		return proceed(storeManagement, clientId);
		
	}

}
